import request from '@/utils/request'

// 查询出库单列表
export function listOutboundOrder(query) {
  return request({
    url: '/wms/outbound/order/list',
    method: 'get',
    params: query
  })
}

// 查询出库单详细
export function getOutboundOrder(orderId) {
  return request({
    url: '/wms/outbound/order/' + orderId,
    method: 'get'
  })
}

// 新增出库单
export function addOutboundOrder(data) {
  return request({
    url: '/wms/outbound/order',
    method: 'post',
    data: data
  })
}

// 修改出库单
export function updateOutboundOrder(data) {
  return request({
    url: '/wms/outbound/order',
    method: 'put',
    data: data
  })
}

// 删除出库单
export function delOutboundOrder(orderId) {
  return request({
    url: '/wms/outbound/order/' + orderId,
    method: 'delete'
  })
}

// 库存分配
export function allocateInventory(orderId) {
  return request({
    url: '/wms/outbound/order/allocate/' + orderId,
    method: 'put'
  })
}

// 开始拣货
export function startPicking(orderId) {
  return request({
    url: '/wms/outbound/order/startPicking/' + orderId,
    method: 'put'
  })
}

// 确认拣货
export function confirmPicking(orderId) {
  return request({
    url: '/wms/outbound/order/pick/' + orderId,
    method: 'put'
  })
}

// 确认出库
export function confirmOutbound(orderId) {
  return request({
    url: '/wms/outbound/order/confirm/' + orderId,
    method: 'put'
  })
}

// 取消出库单
export function cancelOutboundOrder(orderId) {
  return request({
    url: '/wms/outbound/order/cancel/' + orderId,
    method: 'put'
  })
}

// 根据出库单号查询出库单
export function getOutboundOrderByOrderNo(orderNo) {
  return request({
    url: '/wms/outbound/order/orderNo/' + orderNo,
    method: 'get'
  })
}

// 生成出库单号
export function generateOrderNo() {
  return request({
    url: '/wms/outbound/order/generateOrderNo',
    method: 'get'
  })
}